﻿<%@ WebHandler Language="C#" Class="doMessage" %>

using System;
using System.Web;
using System.Web.SessionState;

public class doMessage : IHttpHandler, IRequiresSessionState
{
    
    public void ProcessRequest (HttpContext context) {
        BLL.Message bllmessage=new BLL.Message();
        MODEL.Message model = new MODEL.Message();
        object currentUser = context.Session["currentUser"];
        object mLId = context.Request["MLId"];
        object content=context.Request["message"];
        if (currentUser != null && mLId != null && content != null)
        {
            model.MLId = Convert.ToInt32(mLId);
            model.MFromUId = ((MODEL.Users)currentUser).UId;
            model.MPFromUId =model.MFromUId;//两者相等代表是留言内容 而不是回复内容
            model.MContent = content.ToString();
            //int mid;
            if (bllmessage.takeAMessage(model))
            {
                context.Response.Write("yes");
            }
            else
            {
                context.Response.Write("no");
            }
        }
        else
        {
            context.Response.Write("no");
        }      
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}